<template>
  <div class="error-page">
    <div class="error-content">
      <h1>404</h1>
      <h2>页面不存在</h2>
      <p>抱歉，您访问的页面不存在或已被删除。</p>
      <div class="error-actions">
        <router-link to="/" class="btn-home">返回首页</router-link>
        <button @click="goBack" class="btn-back">返回上一页</button>
      </div>
    </div>
  </div>
</template>

<script setup>
import { useRouter } from 'vue-router'

const router = useRouter()

const goBack = () => {
  router.go(-1)
}
</script>

<style scoped>
.error-page {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 80vh;
  padding: 20px;
}

.error-content {
  text-align: center;
  max-width: 500px;
}

.error-content h1 {
  font-size: 8rem;
  margin: 0;
  color: #6a11cb;
  line-height: 1;
}

.error-content h2 {
  font-size: 2rem;
  margin: 20px 0;
  color: #333;
}

.error-content p {
  font-size: 1.1rem;
  color: #666;
  margin-bottom: 30px;
}

.error-actions {
  display: flex;
  justify-content: center;
  gap: 20px;
}

.btn-home, .btn-back {
  padding: 12px 24px;
  border-radius: 5px;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s;
  text-decoration: none;
  border: none;
}

.btn-home {
  background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%);
  color: white;
}

.btn-home:hover {
  opacity: 0.9;
}

.btn-back {
  background: white;
  color: #6a11cb;
  border: 1px solid #6a11cb;
}

.btn-back:hover {
  background: #f0f0f0;
}

/* 移动端适配 */
@media (max-width: 768px) {
  .error-page {
    min-height: 70vh;
    padding: 15px;
  }
  
  .error-content {
    max-width: 100%;
  }
  
  .error-content h1 {
    font-size: 6rem;
  }
  
  .error-content h2 {
    font-size: 1.8rem;
    margin: 15px 0;
  }
  
  .error-content p {
    font-size: 1rem;
    margin-bottom: 25px;
  }
  
  .error-actions {
    flex-direction: column;
    gap: 15px;
  }
  
  .btn-home, .btn-back {
    width: 100%;
    padding: 12px;
    font-size: 15px;
  }
}

/* 超小屏幕适配 */
@media (max-width: 480px) {
  .error-page {
    min-height: 60vh;
    padding: 10px;
  }
  
  .error-content h1 {
    font-size: 5rem;
  }
  
  .error-content h2 {
    font-size: 1.5rem;
    margin: 12px 0;
  }
  
  .error-content p {
    font-size: 0.95rem;
    margin-bottom: 20px;
  }
  
  .error-actions {
    gap: 12px;
  }
  
  .btn-home, .btn-back {
    padding: 10px;
    font-size: 14px;
  }
}
</style>